package com.logisticsrepair.service;

import com.logisticsrepair.entity.RepairOrdersEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author huahua
 * @description 针对表【repair_orders(报修订单)】的数据库操作Service
 * @createDate 2022-03-12 20:10:16
 */
public interface RepairOrdersService extends IService<RepairOrdersEntity> {

    /**
     * 查询状态为待受理（1）的订单信息
     *
     * @return
     */
    List<RepairOrdersEntity> queryNewOrders();

    /**
     * 根据用户唯一标识，查询用户所有订单记录
     *
     * @param userOpenid 用户唯一标识
     * @return
     */
    List<RepairOrdersEntity> queryUserOrderRecode(String userOpenid);

    /**
     * 维修员根据订单编号接单，并依据版本号更新维修状态等信息
     *
     * @param repairVersion 版本号-乐观锁
     * @param workerOpenid  维修员唯一标识
     * @param orderId       订单编号
     * @return
     */
    int acceptOrder(Integer repairVersion, String workerOpenid, String orderId);


    /**
     * 查询维修订单
     * @return 订单对象list
     */
    List<RepairOrdersEntity> queryWorkerOrder(Map<String, Object> condition);

    /**
     * 驳回订单
     * @param repairOrdersEntity
     * @return
     */
    boolean rejectOrder(RepairOrdersEntity repairOrdersEntity);
}
